package com.cbs.module.social.ui.discussion.test.activity;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.cbs.android.module.discussion.activity.DiscussionListActivity;
import com.cbs.android.module.discussion.activity.DiscussionSummaryActivity;
import com.cbs.android.module.discussion.entity.SubjectSnapshot;
import com.cbs.module.social.ui.discussion.test.R;
import com.cbs.module.social.ui.discussion.test.utils.Forums;
import com.cbs.share.ShareMessage;

/**
 * Created by broche on 5/23/16.
 */
public class SummaryActivity extends DiscussionSummaryActivity {
    private WebView contentView;

    @Override
    protected int getForumId() {
        return Forums.Test;
    }

    @Override
    protected Class<? extends DiscussionListActivity> getListActivityClass() {
        return ListActivity.class;
    }

    @Override
    protected Object onGetData(Context context, int subjectId) {
        return new Object();
    }

    @Override
    protected View onCreateView(Context context, ViewGroup viewGroup) {
        View view = getLayoutInflater().inflate(R.layout.item_news_detail, viewGroup, false);
        contentView = (WebView) view.findViewById(R.id.contentView);

        contentView.setWebViewClient(new WebViewClient() {

            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                // TODO Auto-generated method stub
                view.loadUrl(url);
                return true;
            }
        });
        return view;
    }

    @Override
    protected void onBindView(Context context, View view, Object data) {
        contentView.loadUrl("http://192.168.58.12:82/pages/news/e442db853c665ed8902ba32d6418c65b");
    }

    @Override
    protected SubjectSnapshot onSnapshot(Context context, int subjectId) {
        return new SubjectSnapshot();
    }

    @Override
    protected ShareMessage onShare(Context context, int subjectId) {
        return null;
    }
}
